package com.campus.common.mapper;

import com.campus.common.domain.Friend;
import com.campus.common.dto.FriendDto;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface FriendMapper {
    @Insert("insert into friend(friend_user_id, user_id) value (#{friendUserId}, #{userId})")
    public int insert(Friend friend);
    @Select("select user_info.user_id as friend_user_id, nickname, motto, online_status, avatar from user_info where user_id in (select friend.friend_user_id from  friend where friend.user_id = #{userId})")
    public List<FriendDto> selectFriendInfoByUserId(int userId);
}
